import request from './request/index.js'

export async function addOtherCost(data) {
  try {
    const res = await request.post('/other-cost', data)
    return res.data
  } catch (err) {
    return Promise.reject(err)
  }
}

export async function listOtherCosts(data) {
  try {
    const res = await request.post('/other-cost/list', data)
    return res.data
  } catch (err) {
    return Promise.reject(err)
  }
}

export async function getOtherCost(id) {
  try {
    const res = await request.get(`/other-cost/${id}`)
    return res.data
  } catch (err) {
    return Promise.reject(err)
  }
}

export async function updateOtherCost(data) {
  try {
    const res = await request.put('/other-cost', data)
    return res.data
  } catch (err) {
    return Promise.reject(err)
  }
}

export async function deleteOtherCost(id) {
  try {
    const res = await request.delete(`/other-cost/${id}`)
    return res.data
  } catch (err) {
    return Promise.reject(err)
  }
}

